package com.cloud.base.controller;


import com.cloud.base.domain.dto.OssTokenDto;
import com.cloud.base.service.IOssService;
import com.cloud.core.util.R;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.io.IOException;

/**
 * <p>
 * 字典数据表 前端控制器
 * </p>
 *
 * @author dhaigang
 * @since 2023-04-03
 */
@RestController
@Validated
@RequestMapping("/oss")
public class OssController {
    @Resource
    private IOssService ossService;
    @Tag(name = "v1.0")
    @Operation(summary = "获取oss临时token")
    @PostMapping("/getTempToken")
    @Log(title = "上传oss-获取oss临时token", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<OssTokenDto> getTempToken() throws IOException {

        return R.ok(ossService.getOssTempToken());
    }
}
